package com.tgy.algorithm.base._位运算;

public class _字节对齐 {


    public static int bitTo8(int n) {

        int bit = 7;
        //
        int val = (n + 7) & (~7);
        return val;
    }

    public static int bitTo16(int n) {

        int shiftBit = 4;
        int bit = 1 << shiftBit;
        return ((n + bit - 1) >> shiftBit) << shiftBit;
    }

    public static void main(String[] args) {

        int res = bitTo8(11);
        System.out.println(res);
    }
}
